package fun.yao.common.queue;

/**
 * 存储对象为 字符串 的自定义队列
 * @author csl
 *
 */
public class FileCahceQueueString extends AFileCacheQueue
{
    public FileCahceQueueString()
    {
        super();
    }

    public FileCahceQueueString(int iMaxSize)
    {
        super(iMaxSize);
    }

    public void add(String msg) throws Exception
    {
        super.addObject(msg);
    }

    public String pool() throws Exception
    {
        return (String)super.pollObject(true);
    }

    public String peek() throws Exception
    {
        return (String)super.pollObject(false);
    }

    @Override
    protected byte[] transforToBytes(Object obj) throws Exception
    {

        return ((String)obj).getBytes();
    }

    @Override
    protected Object transforToObject(byte[] msg) throws Exception
    {
        return new String(msg);
    }

}